/*
 * Copyright (c) 2016 zhangcm. All Rights Reserved.
 */
package com.jnzc.ocr.serv.shop.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.jnzc.ocr.common.bean.PageResult;
import com.jnzc.ocr.common.utils.BusinessUtils;
import com.jnzc.ocr.common.utils.ValidateUtils;
import com.jnzc.ocr.dependencies.serv.mybatis.MybatisServiceImpl;
import com.jnzc.ocr.dependencies.serv.utils.MybatisUtils;
import com.jnzc.ocr.serv.shop.entity.ShopNotice;
import com.jnzc.ocr.serv.shop.entity.ShopNotice;
import com.jnzc.ocr.serv.shop.entity.ShopNotice;
import com.jnzc.ocr.serv.shop.filter.ShopNoticeFilter;
import com.jnzc.ocr.serv.shop.filter.ShopNoticeFilter;
import com.jnzc.ocr.serv.shop.mapper.ShopNoticeMapper;
import com.jnzc.ocr.serv.shop.service.ShopNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author zhangcm
 * @version 1.0, 2017/9/13
 */
@Service
public class ShopNoticeServiceImpl extends MybatisServiceImpl<ShopNoticeMapper, ShopNotice, ShopNoticeFilter> implements ShopNoticeService {

    @Autowired
    private ShopNoticeMapper shopNoticeMapper;

    @Override
    protected void fillEntityWrapper(EntityWrapper<ShopNotice> ew, ShopNoticeFilter filter) {
        ShopNotice entity = new ShopNotice();
        entity.setShopId(filter.getShopId());
        ew.setEntity(entity);
    }

    @Override
    public ShopNotice find(Long id, Long shopId) {
        ValidateUtils.isId(id, "通知ID");
        ShopNotice filter = new ShopNotice();
        filter.setId(id);
        filter.setShopId(shopId);
        ShopNotice obj = shopNoticeMapper.selectOne(filter);
        BusinessUtils.notNull(obj, "通知信息为空");
        return obj;
    }
}
